<template>
  <el-drawer
    title="打印按钮"
    :visible.sync="drawer"
    :direction="direction"
    :before-close="handleClose"
    :append-to-body="true"
    size="15%"
  >
    
    <p class="pButton"><el-button type="primary">打印选中</el-button></p>
    <p class="pButton"><el-button type="primary">打印当前页</el-button></p>
    <p class="pButton"><el-button type="primary" @click="handlePrintCurrentShare">打印当前份</el-button></p>
    <p class="pButton"><el-button type="primary">打印当前类</el-button></p>
    <p class="pButton"><el-button type="primary" @click="printEntire">打印全部</el-button></p>
    <printCurrentShare ref="myprintbtn" :list="listBigImg"/>
  </el-drawer>
</template>

<script>
import printCurrentShare from "./components/printCurrentShare"
export default {
  components: {
    printCurrentShare,
  },
  props: {
    listImg: {
      type: Array,
      default: () => [],
      required: true,
    },
  },
  data() {
    return {
      drawer: false,
      direction: "rtl",
      listBigImg:[],
    };
  },
  created(){
//    console.log(this.imageData,"data")
  },
  methods: {
    init(){
       this.drawer = true;
       this.listBigImg = this.listImg;
    },
    //打印当前份
    handlePrintCurrentShare(){
        let refPrint = this.$refs["myprintbtn"];
      refPrint && refPrint.print();
    },
    // 打印全部
    printEntire(){
        let refPrint = this.$refs["myprintbtn"];
      refPrint && refPrint.print();
    },
    handleClose() {
        this.drawer = false;
    },
  },
};
</script>

<style scoped>
.pButton{
    margin-bottom: 10px;
    margin-left: 10px;
}
</style>